<form lay-filter="receiptRecordForm" id="receiptRecordFormContent" class="layui-form open-form" id="receiptRecordForm">
    <div class="open-model">
        <div class="open-auto">
            <input name="id" type="hidden" />
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">领料类型</label>
                    <div class="layui-input-block">
                        <select id="inventoryTypeId" name="inventoryTypeId" lay-filter="inventoryTypeId" disabled
                            lay-search></select>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">开工单编号</label>
                    <div class="layui-input-block">
                        <input id="productionPlanRecordId" name="productionPlanRecordId" type="hidden" />
                        <input id="processId" name="processId" type="hidden" />
                        <input id="workOrderId" name="workOrderId" type="hidden" />
                        <input id="workOrder" name="workOrderCode" class="layui-input" />
                        <!-- <select id="workOrderId" name="workOrderId" lay-filter="workOrderId" lay-search></select> -->
                    </div>
                </div>
            </div>
            <!-- <div class="layui-col-xs4">
          <div class="layui-form-item">
            <label class="layui-form-label">工站任务编号</label>
            <div class="layui-input-block">
              <input
                id="productionProcessDeviceCode"
                name="productionProcessDeviceCode"
                type="text"
                class="layui-input"
                readonly
              />
            </div>
          </div>
        </div> -->
            <!-- <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">工位属性：</label>
                    <div class=" layui-input-block">
                        <input name="typeName" class="layui-input" type="text" disabled />
                    </div>
                </div>
            </div> -->
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">工位性质：</label>
                    <div class=" layui-input-block">
                        <input name="workstationNature" id="workstationNature" type="hidden" />
                        <input name="workstationNatureName" class="layui-input" type="text" disabled
                            readonly="readonly" />
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">设备/工种：</label>
                    <div class=" layui-input-block">
                        <select id="gzsbId" name="gzsbId" lay-filter="gzsbId" lay-search></select>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">工位：</label>
                    <div class=" layui-input-block">
                        <input type="hidden" id="workshopName" name="workshopName" />
                        <select id="workshopId" name="workshopId" lay-filter="workshopId" lay-search></select>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">所属计划</label>
                    <div class="layui-input-block">
                        <input id="productionPlanCode" name="productionPlanCode" type="text" class="layui-input"
                            disabled />
                    </div>
                </div>
            </div>

            <!-- <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">仓库类型</label>
                    <div class="layui-input-block">
                        <select id="warehouseType" name="warehouseType" lay-filter="warehouseType"></select>
                    </div>
                </div>
            </div> -->
            <!-- <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">领料仓库</label>
                    <div class="layui-input-block">
                        <select id="receiptWarehouse" name="receiptWarehouse" lay-filter="receiptWarehouse"
                            lay-search></select>
                    </div>
                </div>
            </div> -->
            <!-- <div class="layui-col-xs4">
        <div class="layui-form-item">
            <label class="layui-form-label">领料料号数</label>
            <div class="layui-input-block">
                <input id="receiptNum" name="receiptNum" type="text" class="layui-input" readonly />
            </div>
        </div>
    </div> -->
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">审核人</label>
                    <div class="layui-input-block">
                        <select id="auditPerson" name="auditPerson" lay-filter="auditPerson" lay-search></select>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4" id="creatorNameDiv">
                <div class="layui-form-item">
                    <label class="layui-form-label">领料人</label>
                    <div class="layui-input-block">
                        <input id="creatorName" name="creatorName" type="text" class="layui-input" readonly />
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <input id="remark" name="remark" type="text" class="layui-input" />
                    </div>
                </div>
            </div>
            <div id="lastDiv" style="display: none;">

            <div class="layui-col-xs4" id="lastProDiv">
                <div class="layui-form-item">
                    <label class="layui-form-label">上道工序可领数</label>
                    <div class="layui-input-block">
                        <input name="canGetQuantity" type="text" class="layui-input" disabled />
                    </div>
                </div>
            </div>
            <div class="layui-col-xs4">
                <div class="layui-form-item">
                    <label class="layui-form-label">领取上道工序数</label>
                    <div class="layui-input-block">
                        <input name="getQuantity" type="text" class="layui-input" />
                    </div>
                </div>
            </div>
        </div>

            <div class="layui-form-item" id="receiptDiv" style="display: none;">
                <div class="addReceiptRecordDetailForm-title">
                    <h3 class="title">领料明细</h3>
                    <button class="layui-btn  addReceiptRecordDetail" data-type="little" type="button"
                        style="margin-top: 10px;float: right;margin-right: 20px;">
                        添加工序关联领料信息
                    </button>
                    <button class="layui-btn  addReceiptRecordDetail" data-type="all" type="button"
                        style="margin-top: 10px;float: right;margin-right: 20px;">
                        添加仓库领料信息
                    </button>
                </div>
                <div class="line"></div>
                <!-- 表格 -->
                <table class="layui-table" id="receiptRecordDetailTable" lay-filter="receiptRecordDetailTable"></table>
            </div>
        </div>
        <div class="layui-form-item text-right" id="commonSubmit">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">
                取消
            </button>
            <button class="layui-btn" id="receiptRecordFormSubmit" type="button" lay-filter="receiptRecordFormSubmit"
                lay-submit>
                提交
            </button>
            <button class="layui-btn auditBox" style="display: none;" type="button" lay-filter="auditBtn" data-type="2"
                lay-submit>
                通过
            </button>
            <button class="layui-btn auditBox" style="display: none;" type="button" lay-filter="auditBtn" data-type="4"
                lay-submit>
                驳回
            </button>

        </div>

    </div>
</form>
<script type="text/html" id="receiptRecordDetailTableBar">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  </script>
<script>
    layui.use(
        [
            "layer",
            "form",
            "table",
            "laydate",
            "admin",
            "laytpl",
            "tableTreeDj",
            "config",
        ],
        async function () {
            var $ = layui.jquery;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var table = layui.table;
            var form = layui.form;
            var config = layui.config;
            var admin = layui.admin;
            var tableTree = layui.tableTreeDj;
            let workObj = {}
            const nowData = { ...parentData };
            if (nowData.eventName == 'add') {
                $(".auditBox").hide();
            } else if (nowData.eventName == 'addLast') {
                $("#lastDiv").show();
            }
            else if (nowData.eventName == 'audit') {
                $(".auditBox").show();
                $("#receiptRecordFormSubmit").hide();
                console.log(333333333);

            } else if (nowData.eventName == 'detail') {
                $("#receiptRecordFormSubmit").hide();
                $(".addReceiptRecordDetail").hide();
            }
            if (nowData.eventName != 'addLast') {
                $("#receiptDiv").show();
            }
            if(nowData.data){
                if(nowData.data.receiptRecordDetailList.length>0){
                    $("#receiptDiv").show();
                }else{
                    $("#receiptDiv").hide();
                    $('#lastDiv').show();
                    $('#lastProDiv').hide();
                }
            }
            $("#creatorNameDiv").hide();
            table.render({
                elem: "#receiptRecordDetailTable",
                data: [],
                cellMinWidth: 100,
                page: false,
                cols: [
                    [
                        { type: "numbers", width: 50, title: "序号" },
                        { field: "skuCode", title: "物料编码", align: "center" },
                        {
                            field: "skuName",
                            title: "物料名称",
                            align: "center",
                            width: 150,
                        },
                        {
                            field: "skuSpec",
                            title: "物料规格",
                            align: "center",
                            width: 150,
                        },
                        {
                            field: "materialNatureName",
                            title: "物料类别性质",
                            align: "center",
                            width: 140,
                        },
                        {
                            field: "productTypeName",
                            title: "物料类别",
                            align: "center",
                            width: 140,
                        },
                        { field: "baseUnitName", title: "基础单位", align: "center" },
                        { field: "unitName", title: "计量单位", align: "center" },
                        { field: "countQuantity", title: "需求总数", align: "center",hide: nowData.eventName != 'add' },
                        {
                            field: "haveQuantity",
                            title: "库存数量",
                            align: "center",
                            hide: nowData.eventName != 'add'
                        },
                        {
                            field: "receiptNum",
                            title: "领取数量",
                            align: "center",
                            width: 140,
                            edit: "text",
                        },
                        {
                            field: "remark",
                            title: "备注",
                            align: "center",
                            width: 160,
                            edit: "text",
                        },
                        {
                            align: "center",
                            toolbar: "#receiptRecordDetailTableBar",
                            title: "操作",
                            width: 100,
                            hide: nowData.eventName != 'add'
                        },
                    ],
                ],
            });

            $(".addReceiptRecordDetail").click(function () {
                
                let type = $(this).data('type')
                if (!$("#workOrderId").val()) {
                    layer.msg("请先选择开工单", { icon: 2 });
                    return;
                }
                // if (!$("#receiptWarehouse").val()) {
                //     layer.msg("请先选择仓库", { icon: 2 });
                //     return;
                // }

                let inIds = []
                admin.formOpen({
                    area: "90%",
                    offset: "50px",
                    title: "配置物料清单",
                    path: "components/purchase/skuTableForm.html",
                    success: function () {
                        if (type == 'little') {
                            inIds = workObj.skuList
                                .map((v) => v.productDetailId)
                                .join(",");
                        }
                        parentData.where = {
                            inIds,
                            // warehouseId: $("#receiptWarehouse").val(),
                            notInListIds: table.cache["receiptRecordDetailTable"]
                                .map((v) => v.productDetailId)
                                .join(","),
                        };
                        // parentData.notInListIds = table.cache["skuTable"]
                        //   .map((v) => v.productDetailId)
                        //   .join(",");
                    },
                    end: function () {
                        if (childData.list) {
                            const newData = childData.list || [];
                            const oldData = table.cache["receiptRecordDetailTable"];
                            let list = [...oldData, ...newData];

                            let skuList=workObj.skuList
                            list=list.map(v=>{
                                let sku=skuList.find(item=>item.productDetailId==v.productDetailId)
                                if(sku){
                                    v.countQuantity=sku.countQuantity?sku.countQuantity:0
                                }
                            return v
                            })
                            table.reload("receiptRecordDetailTable", {
                                data: list, // 设置新的数据
                            });
                        }
                    },
                });
            });
            $('#workOrder').click(function () {
                admin.formOpen({
                    area: "90%",
                    offset: "50px",
                    title: "开工单列表",
                    path: "components/productionPlan/productionWorkOrder.html",
                    success: function () {
                        parentData.eventName = 'radio'
                        parentData.where = {
                            statusFlag: 1,
                            status: "inproduction",
                            processTypes: nowData.eventName == 'addLast' ? '1,2' : '',
                        };
                    },
                    end: async function () {
                        if (childData.list && childData.list.length > 0) {
                            // const newData = childData.list || [];
                            // const oldData = table.cache["receiptRecordDetailTable"];
                            // const list = [...oldData,...newData];
                            // table.reload("receiptRecordDetailTable", {
                            //     data: list, // 设置新的数据
                            // });
                            const res1 = await admin.reqPro(
                                "production/productionPlan/admin/productionWorkOrder/detail/" +
                                childData.list[0].id
                            );
                            let obj = res1.data;
                            if (obj.workstationNatureName == 1) {
                                layer.msg("开工单已结束，不能继续领料", { icon: 2 });
                                return;
                            }
                            if(obj.processType != 0){
                                const res2 = await admin.reqPro(
                                    'production/productionPlan/admin/productionWorkOrder/getUpOneInfo/'+childData.list[0].id
                                )
                                console.log(123,res2);
                                obj.canGetQuantity = res2.data.canGetQuantity
                            }
                            
                            form.val("receiptRecordForm", {
                                productionPlanRecordId: obj.productionPlanRecordId,
                                processId: obj.processId,
                                workOrderId: obj.id,
                                workstationNature: obj.workstationNature,
                                workstationNatureName: obj.workstationNatureName,
                                gzsbId: obj.gzsbId,
                                workshopId: obj.workshopId,
                                workshopName: obj.workshopName,
                                workOrderCode: obj.code,
                                planCode: obj.planCode,
                                receiptRecord: obj.receiptRecord,
                                remark: obj.remark,
                                productionPlanCode: obj.productionPlanCode,
                                canGetQuantity:obj.canGetQuantity ?obj.canGetQuantity:'',
                            })
                            workObj = obj
                            console.log(33, obj);
                            // admin.initDataSelectPro('enterprise/res/admin/setting/workStation/list', {
                            //     deviceModelSpuIds: obj.workstationNatureName == '设备工位' ? obj.deviceTypeList.map(v => v.id).join(',') : '',
                            //     professionIds: obj.workstationNatureName == '人工工位' ? obj.deviceTypeList.map(v => v.id).join(',') : '',
                            // }, 'workshopId', '工位')
                            // table.reload("receiptRecordDetailTable", {
                            //     data: []
                            // })


                            const res2 = await admin.reqPro(
                                "enterprise/res/admin/setting/workStation/list",
                                {
                                    professionId:
                                        res1.data.workstationNature == 1
                                            ? res1.data.gzsbId
                                            : "",
                                    deviceModelSpuId:
                                        res1.data.workstationNature == 2
                                            ? res1.data.gzsbId
                                            : "",
                                }
                            );
                            admin.initDataSelect(
                                res1.data.deviceTypeList,
                                null,
                                "gzsbId",
                                null,
                                "设备机型",
                                "deviceName",
                                "id"
                            );
                            form.on("select(gzsbId)", async function (d) {
                                $("#workshopId").empty();
                                $("#workshopId").val("");
                                form.render("select");
                                let workstationNature = $("#workstationNature").val();
                                console.log(123,workstationNature);
                                
                                if (d.value) {
                                    const res1 = await admin.reqPro(
                                        "enterprise/res/admin/setting/workStation/list",
                                        {
                                            // gzsbId: d.value,
                                            professionId: workstationNature == 2 ? d.value : "",
                                            deviceModelSpuId:
                                                workstationNature == 1 ? d.value : "",
                                        }
                                    );
                                    admin.initDataSelect(
                                        res1.data,
                                        null,
                                        "workshopId",
                                        null,
                                        "工位",
                                        "name",
                                        null
                                    );
                                    form.on("select(workshopId)", async function (d) {
                                        $("#workshopName").val();
                                        $("#workshopName").val(
                                            d.elem[d.elem.selectedIndex].text
                                        );
                                    });
                                }
                            });


                            // form.val("receiptRecordForm", {
                            //     productionPlanRecordId: obj.productionPlanRecordId,
                            //     processId: obj.processId,

                            // });
                            // form.val("receiptRecordForm", { ...res1.data });
                        }

                    }
                });
            })

            //开工单列表
            // await admin.initDataSelectPro(
            //     "production/productionPlan/admin/productionWorkOrder/list",
            //     {
            //         limit: 99999,
            //         statusFlag: 1,
            //         status: "inproduction",
            //     },
            //     "workOrderId",
            //     "开工单",
            //     async (d, obj) => {
            //         form.val("receiptRecordForm", {
            //             productionPlanRecordId: "",
            //             processId: "",
            //             workstationNature: "",
            //             workstationNatureName: "",
            //             gzsbId: "",
            //             workshopId: "",
            //             workshopName: "",
            //             planCode: "",
            //         });
            //         $("#gzsbId").empty();
            //         workObj = null;
            //         if (d.value) {
            //             form.val("receiptRecordForm", {
            //                 productionPlanRecordId: "",
            //                 processId: "",
            //             });
            //             const res1 = await admin.reqPro(
            //                 "production/productionPlan/admin/productionWorkOrder/detail/" +
            //                 obj.id
            //             );
            //             workObj = res1.data;
            //             const res2 = await admin.reqPro(
            //                 "enterprise/res/admin/setting/workStation/list",
            //                 {
            //                     professionId:
            //                         res1.data.workstationNature == 1
            //                             ? res1.data.gzsbId
            //                             : "",
            //                     deviceModelSpuId:
            //                         res1.data.workstationNature == 2
            //                             ? res1.data.gzsbId
            //                             : "",
            //                 }
            //             );
            //             admin.initDataSelect(
            //                 res1.data.deviceTypeList,
            //                 null,
            //                 "gzsbId",
            //                 null,
            //                 "设备机型",
            //                 "deviceName",
            //                 "id"
            //             );
            //             form.on("select(gzsbId)", async function (d) {
            //                 $("#workshopId").empty();
            //                 $("#workshopId").val("");
            //                 form.render("select");
            //                 let workstationNature = $("#workstationNature").val();
            //                 if (d.value) {
            //                     const res1 = await admin.reqPro(
            //                         "enterprise/res/admin/setting/workStation/list",
            //                         {
            //                             // gzsbId: d.value,
            //                             professionId: workstationNature == 1 ? d.value : "",
            //                             deviceModelSpuId:
            //                                 workstationNature == 2 ? d.value : "",
            //                         }
            //                     );
            //                     admin.initDataSelect(
            //                         res1.data,
            //                         null,
            //                         "workshopId",
            //                         null,
            //                         "工位",
            //                         "name",
            //                         null
            //                     );
            //                     form.on("select(workshopId)", async function (d) {
            //                         $("#workshopName").val();
            //                         $("#workshopName").val(
            //                             d.elem[d.elem.selectedIndex].text
            //                         );
            //                     });
            //                 }
            //             });

            //             // admin.req(
            //             //   "production/productionPlan/admin/productionWorkOrder/getWorkOrderDetails",
            //             //   { workOrderId: d.value },
            //             //   function (res) {
            //             //     $("#productionProcessDeviceCode").val(
            //             //       res.data.productionProcessDeviceCode
            //             //     );
            //             //     $("#planCode").val(res.data.planCode);
            //             //   }
            //             // );
            //             form.val("receiptRecordForm", {
            //                 productionPlanRecordId: obj.productionPlanRecordId,
            //                 processId: obj.processId,
            //             });
            //             form.val("receiptRecordForm", { ...res1.data });
            //         }
            //     },
            //     "code"
            // );
            //仓库类型
            // await admin.initDataSelectPro(
            //     "enterprisecab/warehouse/admin/warehouseType/list",
            //     { limit: 99999 },
            //     "warehouseType",
            //     "仓库类型",
            //     async (d, obj) => {
            //         $("#receiptWarehouse").empty();
            //         if (d.value) {
            //             admin.initDataSelectPro(
            //                 "enterprisecab/warehouse/admin/warehouse/list",
            //                 {
            //                     limit: 99999,
            //                     warehouseTypeId: d.value,
            //                 },
            //                 "receiptWarehouse",
            //                 "领料仓库",
            //             );
            //         }
            //     }
            // );

            //初始化领料类型
            // 默认为领料出库 value为5
            await admin.initDataSelectPro(
                "enterprisecab/warehouse/admin/warehouseInventoryType/list",
                { limit: 99999 },
                "inventoryTypeId",
                "领料类型",
            );
            form.val("receiptRecordForm", { inventoryTypeId: 5 });

            //审核人
            await admin.initDataSelectPro(
                "user/admin/user/list",
                { limit: 99999 },
                "auditPerson",
                "审核人",
                null,
                "nickname",
            );


            if (nowData.data && nowData.data.id) {
                const res1 = await admin.reqPro(
                    "production/productionPlan/admin/productionWorkOrder/detail/" +
                    nowData.data.workOrderId
                );
                workObj = res1.data;
                const res2 = await admin.reqPro(
                    "enterprise/res/admin/setting/workStation/list",
                    {
                        professionId:
                            res1.data.workstationNature == 2
                                ? res1.data.gzsbId
                                : "",
                        deviceModelSpuId:
                            res1.data.workstationNature == 1
                                ? res1.data.gzsbId
                                : "",
                    }
                );

                admin.initDataSelect(
                    res1.data.deviceTypeList,
                    null,
                    "gzsbId",
                    null,
                    "设备机型",
                    "deviceName",
                    "id"
                );
                console.log('123', nowData.data);

                await admin.initDataSelectPro(
                    'enterprise/res/admin/setting/workStation/list',
                    {
                        id: nowData.data.workshopId
                    },
                    'workshopId', '工位')

                // await admin.initDataSelectPro(
                //     "enterprisecab/warehouse/admin/warehouse/list",
                //     {
                //         limit: 99999,
                //         warehouseTypeId: nowData.data.warehouseType,
                //     },
                //     "receiptWarehouse",
                //     "领料仓库",
                // );
                form.val("receiptRecordForm", nowData.data);
                table.reload("receiptRecordDetailTable", {
                    data: nowData.data.receiptRecordDetailList, // 设置新的数据 
                })
            }
            form.on('submit(auditBtn)', function (data) {
                let status = $(data.elem).data('type');
                let formData = {
                    receiptId: data.field.id,
                    status: status,
                    remark: data.field.remark,
                }

                admin.req(
                    `enterprise/receiptRecord/admin/receiptRecord/audit/${data.field.id}/${status}`
                    ,
                    {},
                    // JSON.stringify(formData),
                    function (res) {
                        layer.closeAll("loading");
                        if (res.code == 200) {
                            // 提交成功清空缓存数据
                            // materialData = [];
                            layer.msg(res.msg, { icon: 1 });
                            layer.closeAll();
                            table.reload("#receiptRecordTable");

                        } else {
                            layer.msg(res.msg, { icon: 2 });
                        }
                    },
                    "PUT",
                    true,
                    "application/json; charset=utf-8"
                );

            })

            form.on("submit(receiptRecordFormSubmit)", function (d) {
                let flag = false;
                // if (materialData.length == 0) {
                //   layer.msg("请添加领料信息", { icon: 2 });
                //   return false;
                // }
                //领料明细列表
                var detailList = table.cache["receiptRecordDetailTable"];
                detailList.forEach((detail) => {
                    if (
                        detail.receiptNum === "" ||
                        detail.receiptNum === null ||
                        detail.receiptNum === undefined
                    ) {
                        layer.msg(`物料【${detail.skuName}】领取数量不能为空`, { icon: 2 });
                        flag = true;
                        return false;
                    }
                });
                // 控制不能提交为空的数据
                if (flag) {
                    return false;
                }
                d.field.receiptRecordDetailList = detailList;
/**
 * 领料类型 1.从上一道工序领取  2.领取配料
 */
                if (nowData.eventName == 'addLast') {
                    d.field.type = 1
                    if (d.field.getQuantity-d.field.canGetQuantity>0) {
                        layer.msg(`领取数量不能大于可领取数量`, { icon: 2 });
                        return ;
                        
                    }
                }else if (nowData.eventName == 'add') {
                    d.field.type = 2
                }
                // 提交计划
                admin.req(
                    "enterprise/receiptRecord/admin/receiptRecord/add",
                    JSON.stringify(d.field),
                    function (res) {
                        layer.closeAll("loading");
                        if (res.code == 200) {
                            // 提交成功清空缓存数据
                            materialData = [];
                            layer.msg(res.msg, { icon: 1 });
                            layer.closeAll();
                            table.reload("#receiptRecordTable");

                        } else {
                            layer.msg(res.msg, { icon: 2 });
                        }
                    },
                    "POST",
                    true,
                    "application/json; charset=utf-8"
                );
                return false;
            });
            table.on("tool(receiptRecordDetailTable)", function (obj) {
                let rowData = obj.data;
                let list = table.cache['receiptRecordDetailTable'];
                if (obj.event === "del") {
                    // list.splice(obj.data.index, 1);
                    // table.reload('receiptRecordDetailTable', {
                    //     data: list, // 设置新的数据
                    // });
                    let index = $(obj.tr[0]).data("index");
          let list = table.cache["receiptRecordDetailTable"];
          list.splice(index, 1);
          table.reload("receiptRecordDetailTable", { data: list });
                }
            });
        })